home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMICUS14.ADF / Progs / CSquared / CSquared.doc < prev    next >
Text File  |  1989-01-28  |  3KB  |  62 lines

  1. CircleSquared from Sept. '86 Scientific American "Computer Recreations"
  2. column produces wildly colorful but mathematically precise patterns on
  3. your Amiga display.  There is also a treatment of this topic in the
  4. Oct. '86 issue of Computer Language in their "Theory & Practice" column.
  5. It doesn't take nearly as long as the generation of a Mandelbrot either.
  6.  
  7. The program is controlled thru standard intuition menus, gadgets,
  8. and requesters.  Most of the important operating parameters, i.e. corna,
  9. cornb, side, and modval, are modifiable thru these gadgets, requesters,
  10. menues and such.
  11.  
  12.    corna  - the X coordinate of the upper left hand corner of the window
  13.    cornb  - the Y coordinate of the upper left hand corner of the window
  14.    side   - the length of the side of the square
  15.    modval - the modulus value that determines the color of the pixel at
  16.             the point(i, j)
  17.  
  18. The following calculations are made for each point plotted on the display.
  19. Note that this routine, PlotPoints(), was written using the Motorola
  20. Fast Floating Point library.
  21.  
  22.    x = corna + side * i/linesize
  23.    y = cornb + side * j/linesize
  24.    z = x * x + y * y
  25.    c = z MOD modval
  26.  
  27. The point at coordinates (i,j) is colored with color "c".  Note that
  28. the palette of colors is also modifiable thru another requester
  29. containing sixteen color selection gadgets.  Three proportional
  30. gadgets allow the modification the Red, Green, and Blue components
  31. of the selected color.
  32.  
  33. The CLOSEWINDOW gadget causes the program to exit.
  34.  
  35. Also note that there is a Hi-Res mode of operation.  Instead of invoking
  36. the program (from the CLI) as "CSquared" include a runtime parameter of
  37. "-h" such that the new invocation becomes "CSquared -h".  Lo-Res is the
  38. default mode of operation.
  39.  
  40. I freely admit that this program is a hack and was strictly done for
  41. my own personal entertainment.  I am new to C so if you see any wretched
  42. code perhaps you will be understanding.  (I'm also new to the Amiga.)
  43. I am placing this program into the public domain although if you make use
  44. of major portions of the code please give credit where credit is due.
  45. (I'd like to see my name up in lights, too.)  Have fun!
  46.  
  47. This program compiles cleanly under Lattice C version 3.03.  No other
  48. external routines are required except for some of those found in Lattice's
  49. LC.LIB and, of course, AMIGA.LIB.  The standard c.o startup code is also
  50. used as well.
  51.  
  52.    Author:      Bill DuPree (with many thanks to Rob Peck)  
  53.    Date:        09/23/86
  54.  
  55. Address BIX mail to bdupree.
  56. Address written correspondence to:
  57.  
  58.       Bill DuPree
  59.       434 W. Wellington #505
  60.       Chicago, IL. 60657
  61.  
  62.